class Solution {
    public:
        int lengthOfLIS(vector<int>& nums) {
            int n = nums.size();
            vector<int> dp(n,1);
            int ret = dp[0];
            for(int i = 1 ; i < n ; i++){
                int tmpmax = 0;
                for(int j = i-1 ; j >= 0 ; j--){
                    if(nums[j] < nums[i])   tmpmax=max(tmpmax,dp[j]);
                }
                //cout<<tmpmax;
                dp[i] = tmpmax+1;
                ret = max(ret,dp[i]);
            }
            return ret;
    
        }
    };